package cn.dyp.com.agriculture.request;

import org.json.JSONException;
import org.json.JSONObject;

/**
 * 用户登录请求类
 * 
 * @author asus
 */
public class LoginRequest extends AgricultureRequest {
	// action name
	private static final String ACTION = "login";

	private String userName;
	private String password;

	public LoginRequest(String userName) {
		super(userName);
	}

	@Override
	protected String getActionName() {
		return ACTION;
	}

	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	/**
	 * (non-Javadoc)
	 *
	 */
	@Override
	protected String onGetJasonBody() {
		JSONObject jsonObj = new JSONObject();
		try {
			// 用户名
			jsonObj.put("username", userName);
			// 密码
			jsonObj.put("password", password);
			return jsonObj.toString();
		} catch (JSONException e) {
			e.printStackTrace();
		}
		return super.onGetJasonBody();
	}

}
